10 REM TAB(28);"AMAZING PROGRAM"
20 REM TAB(15);"CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY"
30 REM PRINT:PRINT:PRINT:PRINT
100 INPUT "WHAT IS YOUR WIDTH: ";H
101 INPUT "WHAT IS YOUR LENGTH: ";V
102 IF ((H*V)<101)*(H>4)*(V>4) THEN GOTO 120
104 PRINT "MEANINGLESS DIMENSIONS.  TRY AGAIN.":GOTO 100
120 PRINT
130 PRINT
140 PRINT
150 PRINT
160 Q=0:Z=0:X=RND(H)+1
165 FOR I=1 TO H
170 IF I=X THEN GOTO 173
171 PRINT ".--";:GOTO 180
173 PRINT ".  ";
180 NEXT I
190 PRINT "."
195 C=1:@(X*V+1)=C:C=C+1
200 R=X:S=1:GOTO 260
210 IF R#H THEN GOTO 240
215 IF S#V THEN GOTO 230
220 R=1:S=1:GOTO 250
230 R=1:S=S+1:GOTO 250
240 R=R+1
250 IF @(R*V+S)=0 THEN GOTO 210
260 IF R-1=0 THEN GOTO 530
265 IF @((R-1)*V+S)#0 THEN GOTO 530
270 IF S-1=0 THEN GOTO 390
280 IF @(R*V+(S-1))#0 THEN GOTO 390
290 IF R=H THEN GOTO 330
300 IF @((R+1)*V+S)#0 THEN GOTO 330
310 X=RND(3)+1
320 GOSUB 1510 : GOTO POP()
330 IF S#V THEN GOTO 340
334 IF Z=1 THEN GOTO 370
338 Q=1:GOTO 350
340 IF @(R*V+(S+1))#0 THEN GOTO 370
350 X=RND(3)+1
360 GOSUB 1550 : GOTO POP()
370 X=RND(2)+1
380 GOTO 760+(X*30) : REM ON X GOTO 790,820
390 IF R=H THEN GOTO 470
400 IF @((R+1)*V+S)#0 THEN GOTO 470
405 IF S#V THEN GOTO 420
410 IF Z=1 THEN GOTO 450
415 Q=1:GOTO 430
420 IF @(R*V+(S+1))#0 THEN GOTO 450
430 X=RND(3)+1
440 GOSUB 1510 : GOTO POP()
450 X=RND(2)+1
460 GOTO 720+(X*70) : REM ON X GOTO 790,860
470 IF S#V THEN GOTO 490
480 IF Z=1 THEN GOTO 520
485 Q=1:GOTO 500
490 IF @(R*V+(S+1))#0 THEN GOTO 520
500 X=RND(2)+1
510 GOTO 770+(X*20) : REM ON X GOTO 790,910
520 GOTO 790
530 IF S-1=0 THEN GOTO 670
540 IF @(R*V+(S-1))#0 THEN GOTO 670
545 IF R=H THEN GOTO 610
547 IF @((R+1)*V+S)#0 THEN GOTO 610
550 IF S#V THEN GOTO 560
552 IF Z=1 THEN GOTO 590
554 Q=1:GOTO 570
560 IF @(R*V+(S+1))#0 THEN GOTO 590
570 X=RND(3)+1
580 GOSUB 1580 : GOTO POP()
590 X=RND(2)+1
600 GOTO 780+(X*40) : REM ON X GOTO 820,860
610 IF S#V THEN GOTO 630
620 IF Z=1 THEN GOTO 660
625 Q=1:GOTO 640
630 IF @(R*V+(S+1))#0 THEN GOTO 660
640 X=RND(2)+1
650 GOTO 730+(X*90) : REM ON X GOTO 820,910
660 GOTO 820
670 IF R=H THEN GOTO 740
680 IF @((R+1)*V+S)#0 THEN GOTO 740
685 IF S#V THEN GOTO 700
690 IF Z=1 THEN GOTO 730
695 Q=1:GOTO 830
700 IF @(R*V+(S+1))#0 THEN GOTO 730
710 X=RND(2)+1
720 GOTO 810+(X*50) : REM ON X GOTO 860,910
730 GOTO 860
740 IF S#V THEN GOTO 760
750 IF Z=1 THEN GOTO 780
755 Q=1:GOTO 770
760 IF @(R*V+(S+1))#0 THEN GOTO 780
770 GOTO 910
780 GOTO 1000
790 @((R-1)*V+S)=C
800 C=C+1:@((R-1)*V+(S+128))=2:R=R-1
810 IF C=H*V+1 THEN GOTO 1010
815 Q=0:GOTO 260
820 @(R*V+(S-1))=C
830 C=C+1
840 @(R*V+(S-1)+128)=1:S=S-1:IF C=H*V+1 THEN GOTO 1010
850 Q=0:GOTO 260
860 @((R+1)*V+S)=C
870 C=C+1:IF @(R*V+S+128)=0 THEN GOTO 880
875 @(R*V+S+128)=3:GOTO 890
880 @(R*V+S+128)=2
890 R=R+1
900 IF C=H*V+1 THEN GOTO 1010
905 GOTO 530
910 IF Q=1 THEN GOTO 960
920 @(R*V+(S+1))=C:C=C+1:IF @(R*V+S+128)=0 THEN GOTO 940
930 @(R*V+S+128)=3:GOTO 950
940 @(R*V+S+128)=1
950 S=S+1:IF C=H*V+1 THEN GOTO 1010
955 GOTO 260
960 Z=1
970 IF @(R*V+S+128)=0 THEN GOTO 980
975 @(R*V+S+128)=3:Q=0:GOTO 1000
980 @(R*V+S+128)=1:Q=0:R=1:S=1:GOTO 250
1000 GOTO 210
1010 FOR J=1 TO V
1011 PRINT "I";
1012 FOR I=1 TO H
1013 IF @(I*V+J+128)<2 THEN GOTO 1030
1020 PRINT "   ";
1021 GOTO 1040
1030 PRINT "  I";
1040 NEXT I
1041 PRINT
1043 FOR I=1 TO H
1045 IF @(I*V+J+128)=0 THEN GOTO 1060
1050 IF @(I*V+J+128)=2 THEN GOTO 1060
1051 PRINT ":  ";
1052 GOTO 1070
1060 PRINT ":--";
1070 NEXT I
1071 PRINT "."
1072 NEXT J
1073 END
1500 REM *** uBasic subroutines ***
1510 if x=1 then push 790 : return
1530 if x=2 then push 860 : return
1540 push 910 : return
1550 if x=1 then push 790 : return
1560 if x=2 then push 820 : return
1570 push 910 : return
1580 if x=1 then push 820 : return
1590 if x=2 then push 860 : return
1600 push 910 : return
